package com.econ.powercloud.ems.controller;

import com.econ.powercloud.common.base.facade.pojo.MsgResult;
import com.econ.powercloud.ems.common.enums.DitTypeEnum;
import com.econ.powercloud.ems.pojo.DeviceCalDataVO;
import com.econ.powercloud.ems.pojo.DeviceRemoteControlVO;
import com.econ.powercloud.ems.pojo.DeviceYcDataVO;
import com.econ.powercloud.ems.pojo.DeviceYxDataVO;
import com.econ.powercloud.ems.service.biz.DeviceMonitorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author : zjf
 * @Description :设备监控controller
 * @Date : 2023/6/10 15:57
 * @Modified by : zjf
 */
@Api(tags = "设备监控")
@RestController
@RequestMapping(value = "/api/v2/device/monitor")
public class DeviceMonitorController extends ApiBaseController{
    
    @Autowired
    private DeviceMonitorService deviceMonitorService;

    @GetMapping("getDeviceYxData")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "deviceCode", value = "EMS设备编号", dataType = "String"),
    })
    @ApiOperation("获取设备的遥信实时数据")
    public MsgResult<DeviceYxDataVO> getDeviceYxData(@RequestParam("deviceCode")String deviceCode) {
        return successHandler(deviceMonitorService.getDeviceYxData(deviceCode));
    }

    @GetMapping("getDeviceYcData")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "deviceCode", value = "EMS设备编号", dataType = "String"),
    })
    @ApiOperation("获取设备的遥测实时数据")
    public MsgResult<DeviceYcDataVO> getDeviceYcData(@RequestParam("deviceCode")String deviceCode) {
        return successHandler(deviceMonitorService.getDeviceYcData(deviceCode));
    }

    @GetMapping("getDeviceCalYxData")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "deviceCode", value = "EMS设备编号", dataType = "String"),
    })
    @ApiOperation("获取设备的计算遥信实时数据")
    public MsgResult<DeviceCalDataVO> getDeviceCalYxData(@RequestParam("deviceCode")String deviceCode) {
        return successHandler(deviceMonitorService.getDeviceCalData(deviceCode, DitTypeEnum.CAL_YX.getCode()));
    }

    @GetMapping("getDeviceCalYcData")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "deviceCode", value = "EMS设备编号", dataType = "String"),
    })
    @ApiOperation("获取设备的计算遥测实时数据")
    public MsgResult<DeviceCalDataVO> getDeviceCalYcData(@RequestParam("deviceCode")String deviceCode) {
        return successHandler(deviceMonitorService.getDeviceCalData(deviceCode,DitTypeEnum.CAL_YC.getCode()));
    }

    @GetMapping("getDeviceYkData")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "deviceCode", value = "EMS设备编号", dataType = "String"),
    })
    @ApiOperation("获取设备的遥控数据")
    public MsgResult<DeviceRemoteControlVO> getDeviceYkData(@RequestParam("deviceCode")String deviceCode) {
        return successHandler(deviceMonitorService.getDeviceYkData(deviceCode));
    }

    @GetMapping("getDeviceYtData")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "deviceCode", value = "EMS设备编号", dataType = "String"),
    })
    @ApiOperation("获取设备的遥调数据")
    public MsgResult<DeviceRemoteControlVO> getDeviceYtData(@RequestParam("deviceCode")String deviceCode) {
        return successHandler(deviceMonitorService.getDeviceYtData(deviceCode));
    }
}
